<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace app\dynamic\model;

class DynamicThumbs extends \app\BaseModel
{
    protected $name = "massage_dynamic_thumbs";
    protected $append = ["friend_time"];
    public function getFriendTimeAttr($value, $data)
    {
        if(isset($data["create_time"])) {
            return lbGetDates($data["create_time"]);
        }
    }
    public function dataAdd($data)
    {
        $data["create_time"] = time();
        $res = $this->insert($data);
        return $res;
    }
    public function dataUpdate($dis, $data)
    {
        $res = $this->where($dis)->update($data);
        return $res;
    }
    public function dataList($dis, $page)
    {
        $data = $this->where($dis)->order("status desc,id desc")->paginate($page)->toArray();
        return $data;
    }
    public function dataInfo($dis)
    {
        $data = $this->where($dis)->find();
        return !empty($data) ? $data->toArray() : [];
    }
    public function getThumbsList($dis, $page = 10)
    {
        $data = $this->alias("a")->join("massage_service_user_list b", "a.user_id = b.id", "left")->join("massage_dynamic_list c", "a.dynamic_id = c.id", "left")->where($dis)->field("a.*,b.nickName,b.avatarUrl,c.cover,c.title")->group("a.id")->order("a.id desc")->paginate($page)->toArray();
        return $data;
    }
}

?>